package com.ruoyi.demo.controller.app;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.demo.domain.AuctionRecord;
import com.ruoyi.demo.service.IAuctionRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 拍卖记录Controller
 *
 * @author metaee
 * @date 2025-02-24
 */
@Api(tags = "小程序-拍卖记录")
@RestController
@RequestMapping("/app/record")
public class AppAuctionRecordController extends BaseController
{
    @Autowired
    private IAuctionRecordService auctionRecordService;

    /**
     * 查询拍卖记录列表
     */
    @ApiOperation(value = "查询拍卖记录列表", notes = "状态(auction_record_status)")
    @GetMapping("/list")
    public TableDataInfo list(AuctionRecord auctionRecord)
    {
        startPage();
        List<AuctionRecord> list = auctionRecordService.selectAuctionRecordList(auctionRecord);
        return getDataTable(list);
    }

    /**
     * 获取拍卖记录详细信息
     */
    @ApiOperation(value = "获取拍卖记录详细信息", notes = "状态(auction_record_status)")
    @GetMapping(value = "/{recordId}")
    public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
    {
        return success(auctionRecordService.selectAuctionRecordByRecordId(recordId));
    }

    /**
     * 新增拍卖记录
     */
    @ApiOperation(value = "新增拍卖记录", notes = "状态(auction_record_status)")
    @Log(title = "拍卖记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AuctionRecord auctionRecord)
    {
        return toAjax(auctionRecordService.insertAuctionRecord(auctionRecord));
    }

    /**
     * 修改拍卖记录
     */
    @ApiOperation(value = "修改拍卖记录", notes = "状态(auction_record_status)")
    @Log(title = "拍卖记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AuctionRecord auctionRecord)
    {
        return toAjax(auctionRecordService.updateAuctionRecord(auctionRecord));
    }

    /**
     * 删除拍卖记录
     */
    @ApiOperation("删除拍卖记录")
    @Log(title = "拍卖记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{recordIds}")
    public AjaxResult remove(@PathVariable Long[] recordIds)
    {
        return toAjax(auctionRecordService.deleteAuctionRecordByRecordIds(recordIds));
    }
}
